// 百变人设类别
window.categories = window.categories || {};

// 提示词模板
const ROLE_TEMPLATES = {
  // 基础提示词
  basePrompt: '你是一个微博平台神评论专家，能根据输入，分析提起关键点，生成引人注目的神回复。',
  
  // 各人设模板
  classicalChinese: '请以文言文风格重述：{input}',
  bossyCeo: '请以霸道又克制的口吻，简洁直接地表达：{input}',
  catSpeak: '请用可爱软萌的语气回复，适当加入拟声词：{input}',
  daiyu: '请以林黛玉式的细腻感伤与婉转语气回复：{input}',
  roastMaster: '请用机智而克制的吐槽回应，点到为止：{input}',
  poetLibai: '请以盛唐诗意与豪放意象改写：{input}',
  teaTalk: '请以温柔含蓄、暗藏分寸的方式表达：{input}',
  funnyGirl: '请用轻松幽默、接地气的方式回答：{input}',
  luxun: '请以鲁迅式冷峻与洞察重述：{input}',
  readChaotic: '请极简而不失态度地回复：{input}',
  nonsense: '请用一本正经的废话风格展开：{input}',
  layback: '请以玩笑式躺平语气回应：{input}'
};

window.categories.role = {
  "id": "role",
  "name": "百变人设",
  "layout": "row",
  
  // 获取提示词方法
  getPrompt: function(templateName, variables = {}) {
    const base = ROLE_TEMPLATES.basePrompt;
    const template = ROLE_TEMPLATES[templateName] || '';
    let prompt = `${base} ${template}`;
    
    // 替换变量
    Object.entries(variables).forEach(([key, value]) => {
      prompt = prompt.replace(new RegExp(`\\{${key}\\}`, 'g'), value);
    });
    
    return prompt;
  },
  
  // 子分类
  "subcategories": [
    { 
      "id": "classical-chinese", 
      "name": "文言文", 
      "icon": "📜", 
      "subtitle": "古风体",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('classicalChinese', vars);
      }
    },
    { 
      "id": "bossy-ceo", 
      "name": "霸道总裁", 
      "icon": "💼", 
      "subtitle": "强势直接",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('bossyCeo', vars);
      }
    },
    { 
      "id": "cat-speak", 
      "name": "喵喵体", 
      "icon": "🐱", 
      "subtitle": "可爱撒娇",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('catSpeak', vars);
      }
    },
    { 
      "id": "daiyu", 
      "name": "黛玉文学", 
      "icon": "🌸", 
      "subtitle": "柔弱敏感",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('daiyu', vars);
      }
    },
    { 
      "id": "roast-master", 
      "name": "怼人大师", 
      "icon": "🗯️", 
      "subtitle": "犀利但不失礼",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('roastMaster', vars);
      }
    },
    { 
      "id": "poet-libai", 
      "name": "诗仙李白", 
      "icon": "🍶", 
      "subtitle": "豪放飘逸",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('poetLibai', vars);
      }
    },
    { 
      "id": "tea-talk", 
      "name": "茶言茶语", 
      "icon": "🍵", 
      "subtitle": "温柔含蓄",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('teaTalk', vars);
      }
    },
    { 
      "id": "funny-girl", 
      "name": "搞笑女", 
      "icon": "😂", 
      "subtitle": "幽默有梗",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('funnyGirl', vars);
      }
    },
    { 
      "id": "luxun", 
      "name": "鲁迅文学", 
      "icon": "🖋️", 
      "subtitle": "犀利洞察",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('luxun', vars);
      }
    },
    { 
      "id": "read-chaotic", 
      "name": "已读乱回", 
      "icon": "🙄", 
      "subtitle": "惜字如金",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('readChaotic', vars);
      }
    },
    { 
      "id": "nonsense", 
      "name": "废话文学", 
      "icon": "🌀", 
      "subtitle": "一本正经",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('nonsense', vars);
      }
    },
    { 
      "id": "layback", 
      "name": "摆烂文学", 
      "icon": "🛌", 
      "subtitle": "丧丧的",
      "getPrompt": function(vars = {}) {
        return window.categories.role.getPrompt('layback', vars);
      }
    }
  ]
};